package com.david.SendFileToGateway.utils;

import com.david.SendFileToGateway.data.ImageUploadVo;
import com.david.SendFileToGateway.file.MyMultipartFile;
import org.springframework.web.multipart.MultipartFile;

public class ImageUtils {

    /**
     * 将file转换成可以传输的形式
     * @return
     */
    public static synchronized MultipartFile changeFileToMultipartFile(ImageUploadVo imageUploadVo){
        String fileName=imageUploadVo.getFileName();
        byte[] bytes=imageUploadVo.getBytes();
        return new MyMultipartFile(fileName,fileName,null,bytes);
    }
}
